{% if groups['master'] | length == 1 %}
    {% set apiserver = 'cluster-endpoint' + ':' + '6443' %}
{% elif groups['master'] | length > 1 %}
    {% set apiserver = 'cluster-endpoint' + ':' + '8443' %}
{% endif %}

apiServer:
  certSANs:
{% for host in groups['master'] %}
  - {{ hostvars[host].ansible_ssh_host }}
{% endfor %}
{% if vip %}
  - {{ vip }}
{% endif %}
  - "cluster-endpoint"
  timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta2
certificatesDir: /etc/kubernetes/pki
clusterName: {{ clusterName }}
controlPlaneEndpoint: "{{ apiserver }}"
controllerManager:
  extraArgs:
    bind-address: "0.0.0.0"
etcd:
  local:
    dataDir: {{ data_root }}/etcd
    extraArgs:
      listen-metrics-urls: "http://0.0.0.0:2381"
imageRepository: {{ imageRepository }}
kind: ClusterConfiguration
kubernetesVersion: {{ k8s_version }}
networking:
  dnsDomain: {{ cluster_domain }}
  serviceSubnet: "{{ service_cidr }}"
  podSubnet: "{{ pod_cidr }}"
scheduler:
  extraArgs:
    bind-address: "0.0.0.0"
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
## 监控数据端口监听的地址
metricsBindAddress: 0.0.0.0
## 运行模式。ipvs或者iptables，默认为空（iptables）
mode: "{{ kube_proxy_mode }}"
